package com.tb.mapper;

import com.github.pagehelper.Page;
import com.tb.DTO.scheduleDTO;
import com.tb.DTO.schedulePageQueryDTO;
import com.tb.entity.schedule;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.*;

import java.sql.Timestamp;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface TbMapper {


    /*
     * 查询日程
     */
    @Select("select * from schedule where id=#{id}")
    @ResultMap("scheduleResultMap")
    schedule get(Long id);
    /*
     * 修改日程
     */


    int deleteScheduleById(Long id);

    /*
     * 批量删除
     */
    int deleteScheduleByBatch(Long[] ids);

    /*
     * 修改状态
     */
    void updateSchedule(scheduleDTO scheduleDTO);

    int updateStatus(Long id, Integer status);

    /*
     * 添加日程
     */
    @Insert("INSERT INTO schedule (title, type, start_time, end_time, priority, status) " +
            "VALUES (#{title}, #{type}, #{startTime}, #{endTime}, #{priority}, #{status})")
    int add(@Param("title") String title,
            @Param("type") Integer type,
            @Param("startTime") LocalDateTime startTime,
            @Param("endTime") LocalDateTime endTime,
            @Param("priority") Integer priority,
            @Param("status") Integer status);

    Page<schedule> pageQuery(String title, Integer type, Integer priority, Integer status, LocalDate startTime, LocalDate endTime);


    //查询日程列表

}
